<include file="public:top" />
<!--编辑菜单-->
<form class="layui-form layui-form-pane" action="" style="padding:20px;">
   <input type="hidden" name="id" value="{$info.id}" />
   
  <div class="layui-form-item">
    <label class="layui-form-label">类型</label>
    <div class="layui-input-block">
        <select id="type" name="type">
			<option value="uname" <if condition="$info['type'] eq uname">selected="selected"</if>>会员名</option>
			<option value="ip" <if condition="$info['type'] eq ip">selected="selected"</if>>ip</option>
			<option value="email" <if condition="$info['type'] eq email">selected="selected"</if>>email</option>
		</select>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">内容</label>
    <div class="layui-input-block">
      <input type="text" name="name" id="name" placeholder="请输入" class="layui-input" value="{$info.name}">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">有效期</label>
    <div class="layui-input-block">
    <input type="text" class="layui-input" name="expires_time" id="expires_time" placeholder="yyyy-MM-dd" value="{$info.expires_time|date='Y-m-d',###}">
    </div>
  </div>
   
  <div class="layui-form-item">
        <label class=""></label>
        <div class="layui-input-block">
        <button class="layui-btn" lay-submit="" lay-filter="upbtn">提交保存</button>
        </div>
    </div>
</form>



<script type="text/javascript" src="__PUBLIC__/admin/layui/layui.js"></script>
<script>
//Demo
layui.use(['layer','jquery','form','element','laydate'], function () {
   // 操作对象
    var layer = layui.layer,$ = layui.jquery,form = layui.form, element = layui.element , laydate = layui.laydate;
  
  //日期时间范围
  laydate.render({
    elem: '#expires_time',
    value:"{$info.expires_time|date='Y-m-d',###}"
  });



   // 提交
    form.on('submit(upbtn)', function (data) {
        // 提交到方法 默认为本身
        $.post("{:u('ipban/edit')}",data.field,function(res){
            if(res.status ==  1){
                layer.msg(res.msg,{time:1800},function(){
                    //关闭弹层后刷新父页面
                    window.parent.location.reload();
                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
                    parent.layer.close(index); 
                });
            }else{
                layer.msg(res.msg,{time:1800},function(){
                    //关闭弹层后刷新父页面
                    window.parent.location.reload();
                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
                    parent.layer.close(index); 
                });
            }
        });
        return false;
    });

    

});
</script>